package com.zhijiang.hospital.service.impl;

import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.zhijiang.hospital.entity.Checkin;
import com.zhijiang.hospital.mapper.CheckinMapper;
import com.zhijiang.hospital.service.CheckinService;
import com.zhijiang.util.BaseQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@Service
public class CheckinServiceImpl implements CheckinService {
    @Resource
    CheckinMapper checkinMapper;

    @Override
    public void add(Checkin checkin) {
        Integer one = checkinMapper.get(checkin);
        //是空就添加
        if (one < 1) {
            checkinMapper.add(checkin);
        }
    }

    @Override
    public List<Checkin> gedt() {
        Date a = new Date();
        a.setHours(0);
        a.setMinutes(0);
        a.setSeconds(0);
        Date a1 = new Date();
        a1.setHours(23);
        a1.setMinutes(59);
        a1.setSeconds(59);
        List<Checkin> checkins = checkinMapper.getList(a.toString(), a1.toString());
        return null;
    }

    //查询
    @Override
    public List<Checkin> getCheckDate(BaseQuery baseQuery) {

        return checkinMapper.getCheckDate(baseQuery);
    }
}
